/* This .do file provides the code that produces Figures A11-A14 of the Online Supplementary Materials of:

Paglayan, Agustina S. 2021. "From Rebellion to Indoctrination: The Violent Rise of Primary Education Systems." American Political Science Review. 

Before executing the code, download the following datasets in your selected path/ directory:
France statistics.csv
France school types.dta

The code below was generated with Stata version 16.

*/

clear all
set more off, perm
global path "C:\Users\pagla\Dropbox\Stanford\Dissertation\Civil War, State Consolidation, and the Spread of Mass Education\Papers\Submission\APSR\APSR Replication\"  	// PATH TO THE DATASETS
cd "${path}"
insheet using "${path}France statistics.csv", names case comma 
sort year 
rename v10 primenroll_per100pop6to13_median
local vars DEP_Primary_PublicPriv DEP_Primary_Priv DEP_Primary_Public DEP_Primary_communes DEP_Primary_departments DEP_Primary_centralgovt
foreach i of local vars {
gen real`i'=.
replace real`i'=`i'*(100/cpi)
}

* FIGURE A11, PANEL A: Number of primary schools adjusted by total population using data on number of schools provided by Grew and Harrigan in Table S1 (they estimate before 1837 the total number of schools including girls schools) and using census data on population size
*__________________________________________________________________________________________________________________________________________________________

ipolate primschools_1000inhab_Harrigan year, gen(iprimschools_1000inhab)
ipolate population year, gen(ipopulation)
gen primschools_1000inhab=.
replace primschools_1000inhab=(primschools_Harrigan/ipop)*1000
ipolate primschools_1000inhab year, gen(iprimschools_1000inhab_mine)
graph twoway (connect primschools_1000inhab year, mcolor(midgreen) lcolor(midgreen) lpattern(solid)) /// 
(connect primschools_1000inhab_Harrigan year, mcolor(green) lcolor(green) lpattern(solid)) /// 
if year>=1813 & year<=1900, /// 
xlin(1833 1850 1881, lcolor(black))  ///
xlin(1830 1848, lcolor(gs10))  ///
text(2 1833 "Guizot Law", placement(w) orientation(vertical)) ///
text(2 1830 "July Monarchy begins", placement(w) orientation(vertical) color(gs10)) ///
text(1.25 1848 "July Monarchy ends", placement(w) orientation(vertical) color(gs10)) ///
text(1.25 1850 "Falloux Law", placement(w) orientation(vertical)) ///
text(1 1881 "Jules Ferry Laws", placement(w) orientation(vertical)) ///
legend(order(1 2) label(1 "Author's estimates") label(2 "Grew & Harrigan") rows(2)) ///
ytitle("# of Primary Schools per 1,000 Inhabitants")  ///
xtitle("Year") scheme(s1manual) scale(0.7) ///
name(FigureA11_A, replace)

* FIGURE A11, PANEL B: Primary school enrollment rate using data from Grew and Harrigan
*______________________________________________________________________________________

graph twoway (connect primstudent_per10000inhab_Harrig year, mcolor(midgreen) lcolor(midgreen) lpattern(solid)) /// 
(connect primenroll_per100pop6to13_median year, yaxis(2) mcolor(green) lcolor(green) lpattern(solid)) /// 
if year>=1829 & year<=1900, /// 
xlin(1833 1850 1881, lcolor(black))  ///
xlin(1830 1848, lcolor(gs10))  /// 
ytitle("Enrollment per 10,000 Inhabitants")  /// 
ytitle("Enrollment as a % of Pop. Ages 6-13", axis(2))  /// 
xtitle("Year") scheme(s1manual) scale(0.7)  ///
legend(order(1 2) label(1 "Enrollment per 10,000 Inhabitants (left)") label(2 "Enrollment as a % of pop. ages 6-13, median across departments (right)") rows(2)) /// 
text(750 1833 "Guizot Law", placement(w) orientation(vertical)) ///
text(750 1830 "July Monarchy begins", placement(w) orientation(vertical) color(gs10)) ///
text(750 1848 "July Monarchy ends", placement(w) orientation(vertical) color(gs10)) ///
text(750 1850 "Falloux Law", placement(w) orientation(vertical)) ///
text(750 1881 "Jules Ferry Laws", placement(w) orientation(vertical)) ///
name(FigureA11_B, replace)

* FIGURE A12: Primary education expenditures, 1820-1900
*______________________________________________________________________________________

* PANEL A: Public and private primary education expenditures in millions of new francs at 1820 prices

sort year
graph twoway (line realDEP_Primary_PublicPriv year, lcolor(black) lpattern(solid) lwidth(thick)) /// 
(line realDEP_Primary_Priv year, lcolor(orange) lpattern(solid) lwidth(thin)) /// 
(line realDEP_Primary_Public year, lcolor(midblue) lpattern(solid) lwidth(thin)) /// 
if year>=1820 & year<=1900, ///
xlin(1833 1850 1881, lcolor(black))  ///
xlin(1830 1848, lcolor(gs10))  /// 
text(1 1833 "Guizot Law", placement(w) orientation(vertical) size(small) lpattern(thin)) ///
text(1 1830 "July Monarchy begins", placement(w) orientation(vertical) color(gs10) size(small) lpattern(thin)) ///
text(1 1848 "July Monarchy ends", placement(w) orientation(vertical) color(gs10) size(small) lpattern(thin)) ///
text(1 1850 "Falloux Law", placement(w) orientation(vertical) size(small) lpattern(thin)) ///
text(1.5 1881 "Jules Ferry Laws", placement(w) orientation(vertical) size(small) lpattern(thin)) ///
xtitle("Year") ///
ytitle("Primary Education Expenditures" "in millions of new francs at 1820 prices") ///
legend(order(1 2 3) label(1 "Private + Public") label(2 "Private") label(3 "Public") rows(1)) ///
scheme(s1manual) name(FigureA12_A, replace)

* Panel B: Public primary education expenditures as a percentage of GDP and of total public spending

graph twoway (line DEP_Primary_Public_pctGDP year, lcolor(midblue) lpattern(solid) lwidth(thick)) /// 
(line DEP_Primary_pctTotPublicExpend year, lcolor(blue) lpattern(dash) lwidth(thin) yaxis(2)) /// 
if year>=1820 & year<=1900, ///
xlin(1833 1850 1881, lcolor(black))  ///
xlin(1830 1848, lcolor(gs10))  /// 
text(0.55 1833 "Guizot Law", placement(w) orientation(vertical) size(small) lpattern(thin)) ///
text(0.55 1830 "July Monarchy begins", placement(w) orientation(vertical) color(gs10) size(small) lpattern(thin)) ///
text(0.55 1848 "July Monarchy ends", placement(w) orientation(vertical) color(gs10) size(small) lpattern(thin)) ///
text(0.55 1850 "Falloux Law", placement(w) orientation(vertical) size(small) lpattern(thin)) ///
text(0.3 1881 "Jules Ferry Laws", placement(w) orientation(vertical) size(small) lpattern(thin)) ///
xtitle("Year") ///
ytitle("Public Primary Education Expenditures" "as % of GDP") ///
ytitle("Public Primary Education Expenditures" "as % of Total Public Spending", axis(2)) ///
legend(order(1 2) label(1 "Public primary education expenditure as a % of GDP (left)") label(2 "as % of total public spending (right)") size(small) rows(2)) ///
scheme(s1manual) name(FigureA12_B, replace)

* FIGURE A13: Local, departmental, and central government spending on primary education, 1820-1870 
*___________________________________________________________________________________________________
 
graph twoway (line realDEP_Primary_communes year, lcolor(midgreen) lpattern(solid) lwidth(thin)) /// 
(line realDEP_Primary_departments year, lcolor(red) lpattern(solid) lwidth(thin)) /// 
(line realDEP_Primary_centralgovt year, lcolor(black) lpattern(solid) lwidth(thick)) /// 
if year>=1820 & year<=1870, ///
xlin(1833 1850 1881, lcolor(black))  ///
xlin(1830 1848, lcolor(gs10))  /// 
text(0.15 1833 "Guizot Law", placement(w) orientation(vertical) size(small) lpattern(thin)) ///
text(0.15 1830 "July Monarchy begins", placement(w) orientation(vertical) color(gs10) size(small) lpattern(thin)) ///
text(0.15 1848 "July Monarchy ends", placement(w) orientation(vertical) color(gs10) size(small) lpattern(thin)) ///
text(0.15 1850 "Falloux Law", placement(w) orientation(vertical) size(small) lpattern(thin)) ///
xtitle("Year") ///
ytitle("Primary Education Expenditures" "in millions of new francs at 1820 prices") ///
legend(order(1 2 3) label(1 "Municipal spending") label(2 "Departmental spending") label(3 "Central government spending") rows(3)) ///
scheme(s1manual) name(FigureA13, replace)

* FIGURE A14: Primary schools in France by public vs. private type
*_________________________________________________________________

use "${path}France school types.dta", clear
preserve
collapse (sum) ECOLES_TOTAL ECOLES_PUBLIQUES ECOLES_LIBRES , by(year)
replace year=year+1000
local vars ECOLES_TOTAL ECOLES_PUBLIQUES ECOLES_LIBRES 
foreach i of local vars {
replace `i'=. if `i'==0
}
graph twoway (connect ECOLES_TOTAL year, mcolor(black) lcolor(black) mstyle(O) lpattern(solid) lwidth(thick)) /// 
(connect ECOLES_PUBLIQUES year, mcolor(midblue) lcolor(midblue) mstyle(O) lpattern(solid)) /// 
(connect ECOLES_LIBRES year, mcolor(orange) lcolor(orange) mstyle(O) lpattern(solid)) /// 
if year>=1828 & year<=1863, ///
xtitle("Year") ///
ytitle("Number of Primary Schools") ///
legend(order(1 2 3) label(1 "Public + Private") label(2 "Public") label(3 "Private") rows(1)) ///
xlin(1833 1850 1881, lcolor(black))  ///
xlin(1830 1848, lcolor(gs10))  /// 
text(50000 1833 "Guizot Law", placement(w) orientation(vertical) size(small) lpattern(thin)) ///
text(50000 1830 "July Monarchy begins", placement(w) orientation(vertical) color(gs10) size(small) lpattern(thin)) ///
text(30000 1848 "July Monarchy ends", placement(w) orientation(vertical) color(gs10) size(small) lpattern(thin)) ///
text(30000 1850 "Falloux Law", placement(w) orientation(vertical) size(small) lpattern(thin)) ///
scheme(s1manual) name(FigureA14, replace)
restore
